{% extends 'myadmin/base.html' %}
{% block main_body %}
<style>
  .table-box {
        overflow-x: auto;
        margin: 10px 0;
    }
  .dataTable {
        min-width: 1200px;
    }
  .dataTable th, 
  .dataTable td {
        padding: 8px 12px;
        text-align: center;
    }
  .notice-content {
        max-width: 300px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
</style>
<section class="content-header">
    <h1>系统通知详情</h1>
    <ol class="breadcrumb">
        <li><a href="{% url 'myadmin_index' %}"><i class="fa fa-home"></i> 首页</a></li>
        <li class="active">系统通知详情</li>
    </ol>
</section>
<section class="content">
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">系统通知列表</h3>
        </div>
        <div class="box-body">
            <div class="table-box">
                <table class="table table-bordered table-striped dataTable">
                    <thead>
                        <tr>
                            <th>通知ID</th>
                            <th>通知标题</th>
                            <th>通知内容</th>
                            <th>发布时间</th>
                            <th>过期时间</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for notice in notices %}
                            <tr>
                                <td>{{ notice.notice_id }}</td>
                                <td>{{ notice.title }}</td>
                                <td class="notice-content" title="{{ notice.content }}">{{ notice.content }}</td>
                                <td>{{ notice.publish_time }}</td>
                                <td>
                                    {% if notice.expire_time %}
                                        {{ notice.expire_time }}
                                    {% else %}
                                        永不过期
                                    {% endif %}
                                </td>
                                <td>
                                    {% if notice.is_active %}
                                        有效
                                    {% else %}
                                        已失效
                                    {% endif %}
                                </td>
                                <td>
                                    <a href="{% url 'myadmin_systemnotice_edit' notice.notice_id %}" class="btn bg-primary btn-xs">编辑</a>
                                    <a href="{% url 'myadmin_systemnotice_delete' notice.notice_id %}" class="btn btn-xs btn-danger" onclick="return confirm('确定要删除这条通知吗？')">删除</a>
                                </td>
                            </tr>
                        {% empty %}
                            <tr><td colspan="6">暂无系统通知记录</td></tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</section>
{% endblock %}